<?php
  $Events = $GLOBALS['MYT']->db_array("SELECT hc_prfalerts.REF, sysTime, name AS RefUser, hc_prfalerts.TYPE, Msg, Status
  	FROM hc_prfalerts
  	INNER JOIN systemoffice.main_users ON main_users.ref = RefUser
	WHERE RefClient = ".$_POST['CliNumero']);
  $DBCR_Events = $Events[0];

  $Locks = $GLOBALS['MYT']->db_array("SELECT blk_ID, blk_Fecha, name AS RefUser, lbk_Tipo, blk_Informacion, blk_STATUS
  	FROM hd_bloqueos
  	INNER JOIN systemoffice.main_users ON main_users.ref = blk_Usuario
	WHERE blk_Codigo = ".$_POST['CliNumero']);
  $DBCR_Locks = $Locks[0];

  $prt_Str = '';

$prt_Str .= '<div class="Line" style="padding:2px;border:2px solid #008080;">
<div style="font-weight:bold;border:1 solid #888888;padding:5px;margin:1px;width:200px;float:left">HistÓrico de eventos</div>
<div style="float:right">'.rt_field('button','ED','HistClose','Fechar HistÓrico','','','','" style="margin:2px;padding:2px" onclick="
		document.getElementById(\'Hist_Show\').innerHTML=\'\';').'</div>
<table width="100%"  border="0" cellspacing="1" cellpadding="1">
  <tr bgcolor="#BFCED0">
    <td width="80">Numero</td>
    <td width="150">Data</td>
    <td width="80">Tipo</td>
    <td width="30%">Observação</td>
    <td width="150">Funcionario</td>
    <td width="150">Situacao</td>
  </tr>';

  for ($g = 1; $g <= $DBCR_Events; $g++) {
  $prt_Str .= '<tr>
    <td>'.$Events[$g]['REF'].'</td>
    <td>'.$Events[$g]['sysTime'].'</td>
    <td>'.$Events[$g]['TYPE'].'</td>
    <td>'.$Events[$g]['Msg'].'</td>
    <td>'.$Events[$g]['RefUser'].'</td>
    <td>'.$Events[$g]['Status'].'</td>
  </tr>';
  }
$prt_Str .= '</table>
<div style="font-weight:bold;border:1 solid #888888;padding:5px;margin:1px;width:200px;float:left">HistÓrico de bloqueios</div>
<table width="100%"  border="0" cellspacing="1" cellpadding="1">
  <tr bgcolor="#BFCED0">
    <td width="80">Numero</td>
    <td width="150">Data</td>
    <td width="80">Tipo</td>
    <td width="30%">Observação</td>
    <td width="150">Funcionario</td>
    <td width="150">Situacao</td>
  </tr>';

  for ($g = 1; $g <= $DBCR_Locks; $g++) {
  $prt_Str .= '<tr>
    <td>'.$Locks[$g]['blk_ID'].'</td>
    <td>'.$Locks[$g]['blk_Fecha'].'</td>
    <td>'.$Locks[$g]['lbk_Tipo'].'</td>
    <td>'.$Locks[$g]['blk_Informacion'].'</td>
    <td>'.$Locks[$g]['RefUser'].'</td>
    <td>'.$Locks[$g]['blk_STATUS'].'</td>
  </tr>';
  }
$prt_Str .= '</table>
</div>';

	#Show Results
	echo $prt_Str;

